const Router = require("koa-router");

const { verifyAuth } = require("../middleware/auth.middleware");
const { verifyConfigExists } = require("../middleware/config.middleware");

const {
  create,
  list,
  detail,
  update,
  remove,
} = require("../controller/config.controller.js");

const configRouter = new Router({ prefix: "/config" });

configRouter.post("/", verifyAuth, verifyConfigExists, create);
configRouter.get("/", list);
configRouter.get("/:configId", detail);
configRouter.patch("/", verifyAuth, update);
configRouter.delete("/:configId", verifyAuth, remove);

module.exports = configRouter;
